@extends('layout.adminlayout')
@section('css')
<script src="/admin/js/metisMenu.min.js"></script>
<script src="/admin/js/custom.js"></script>
<link href="/admin/css/custom.css" rel="stylesheet">
@endsection
@section('content')
<div class="tables">
	<div class="table-responsive bs-example widget-shadow">
		<h4 style="margin-bottom: 15px;">网关列表 :</h4>
		<form action="/admin/gateway/index" method="get">
			<div class="row" style="padding-bottom: 15px;margin-top: 0px;">
				<p class="col-lg-1 col-md-1 col-sm-1 col-xs-1" style="width: 70px; height: 32px;padding: 0px;text-align: right;line-height: 32px;">代理商：</p>
				<select name="ag" class="col-lg-1 col-md-1 col-sm-1 col-xs-1" style="height: 30px; line-height: 30px; padding: 0px; border: 1px solid #DDD; margin: 0px 10px; width: 15%;">
					<option value="">请选择代理商</option>
					@foreach($agent as $v)
						<option value="{{$v['id']}}"
								@if($get['ag'] == $v['id'])
								selected
								@else
								@if(Cookie::get('agentId') == $v['id'])
								selected
								@endif
								@endif>{!! $v['agent_name'] !!}</option>
					@endforeach
				</select>
			<p class="col-lg-1 col-md-1 col-sm-1 col-xs-1" style="width: 90px; height: 32px;padding: 0px;text-align: right;line-height: 32px;">Gateway ID：</p>
			<input type="text" name="eui" value="{{$get['eui']}}" class="col-lg-1 col-md-1 col-sm-1 col-xs-1" style="height: 30px; line-height: 30px; padding: 0px; border: 1px solid #DDD; margin: 0px 10px; width: 15%;"/>
			<p class="col-lg-1 col-md-1 col-sm-1 col-xs-1" style="width: 90px; height: 32px;padding: 0px;text-align: right;line-height: 32px;">网关名称：</p>						
			<input type="text" name="name" id="" value="{{$get['name']}}" class="col-lg-1 col-md-1 col-sm-1 col-xs-1" style="height: 30px; line-height: 30px; padding: 0px; border: 1px solid #DDD; margin: 0px 10px; width: 15%;"/>
			<input type="submit" value="搜索" class="col-lg-1 col-md-1 col-sm-1 col-xs-1"  style="height: 30px; line-height: 32px; padding: 0px; border: 0; background: #4F52BA;width: 50px; margin: 0px 10px;color:#fff"/>	
		</div>
		</form>
		<table class="table table-bordered">
			<thead>		
 				<tr>
					<th>Gateway ID</th>
					<th>网关名称</th>
					<th>所属类型</th>
					<th>功率</th>
					<th>百度经度</th>
					<th>百度纬度</th>
					<th>在线状态</th>
					<th>添加时间</th>
					@if(Cookie::get('agentId') == 1)
					<th>操作</th>
					@endif
				</tr>
			</thead>
			<tbody>
					@if(!null == $res)
						@foreach($res as $k=>$v)
						<tr>
							<th scope="row">{{$v['bs_eui']}}</th> 
							<td>{{$v['bs_name']}}</td>
							<td>{{$v['bs_model']}}</td>
							<td>{{$v['bs_txpower']}}Bm</td>
							<td>{{$v['longitude']}}</td>
							<td>{{$v['latitude']}}</td>
							@if($v['bs_status']==1)
							<td align="center"><img src="/admin/images/online.png" alt="在线"></td>
							@elseif($v['bs_status']==0)
							<td align="center"><img src="/admin/images/offline.png" alt="离线"></td>
							@elseif($v['bs_status']== false)
							<td align="center">该网关不属于你</td>
							@endif
							<td>{{$v['bs_add_time']}}</td>
							@if(Cookie::get('agentId') == 1)
							<td><a href="/admin/gateway/edit?id={{$v['bs_eui']}}">修改</a>|<a href="/admin/gateway/destroy?id={{$v['bs_eui']}}">删除</a></td>
							@endif
						</tr>
						@endforeach
					@endif
			</tbody> 
		</table>
		@if(!null == $data)
			<div style="float:right;">
				{!! $data->appends($request)->render() !!}
			</div>
		@endif
	</div>
</div>
@endsection